import request from '@/utils/request'

// 查询所有的商品分类
export const CategoryTree = () => {
        return request({
            url: "/admin/category/all",
            method: "GET"
        })
    }
    // 批量删除商品分类
export const removeIds = query => {
        return request({
            url: "/admin/category/delete",
            method: 'post',
            data: query
        })
    }
    // 添加商品分类
export const addCategory = query => {
        return request({
            url: '/admin/category/save',
            method: 'post',
            data: query
        })
    }
    // 根据id查询商品分类
export const getCategory = id => {
        return request({
            url: "/admin/category/info/" + id,
            method: "GET"
        })
    }
    //修改商品分类
export const updateCategory = query => {
        return request({
            url: "/admin/category/update",
            method: "POST",
            data: query
        })
    }
    // ---------------------------商品--------------------------------
export const goodsAll = () => {
        return request({
            url: "/admin/goods/all",
            method: 'GET'
        })
    }
    //上传图标
export const uploadGoodsImage = query => {
        return request({
            url: "/admin/goods/upload",
            method: 'post',
            data: query
        })
    }
    //添加商品
export const addGoods = query => {
        return request({
            url: "/admin/goods/save",
            method: 'post',
            data: query
        })
    }
    //根据分类id查询商品
export const catGoods = query => {
        return request({
            url: "/admin/goods/catGoods/" + query,
            method: "get"
        })
    }
    //根据id查询商品
export const goodsById = query => {
        return request({
            url: "/admin/goods/info/" + query,
            method: 'get',
        })
    }
    //修改商品
export const updateGoods = query => {
        return request({
            url: "/admin/goods/update",
            method: 'post',
            data: query
        })
    }
    //删除删除
export const delGoods = query => {
    return request({
        url: "/admin/goods/del/" + query,
        method: 'post',
    })
}
export const seachGoods = query => {
        return request({
            url: "/admin/goods/info?goodsName=" + query,
            method: 'get'
        })
    }
    //-----------------------广告管理-----------------------
    // 查询所有的轮播图
export const swiperAll = () => {
        return request({
            url: "/admin/swiper/all",
            method: 'get'
        })
    }
    //添加轮播图
export const addSwiper = query => {
    return request({
        url: "/admin/swiper/add",
        method: 'post',
        data: query
    })
}
export const delSwiper = query => {
        return request({
            url: "/admin/swiper/del/" + query,
            method: "post"
        })
    }
    //-----------------商品详情-------------------
export const addDetails = query => {
        return request({
            url: "/admin/details/save",
            method: "post",
            data: query
        })
    }
    // 删除商品详情
export const delDetails = query => {
    return request({
        url: "/admin/details/del/" + query,
        method: "post"
    })
}
export const WxUserAll = () => {
        return request({
            url: "/wx/user/all",
            method: "get"
        })
    }
    //查询所有的订单
export const orderAll = () => {
        return request({
            url: "/wx/order/all",
            method: "get"
        })
    }
    //根据订单编号查询所有的订单
export const getOrders = query => {
        return request({
            url: "/wx/order/getOrder?orderNumber=" + query,
            method: "get",
        })
    }
    //各数据的总条数
export const userCount = () => {
    return request({
        url: "/count",
        method: "get"
    })
}
export const goodsCount = () => {
    return request({
        url: "/admin/goods/count",
        method: "get"
    })
}
export const categoryCount = () => {
    return request({
        url: "/admin/category/count",
        method: "get"
    })
}
export const orderCount = () => {
        return request({
            url: "/wx/order/count",
            method: "get"
        })
    }
    // melecount的人数
export const maleCount = () => {
    return request({
        url: "/maleCount",
        method: "get"
    })
}

// 订单的修改
export const updateOrder = query => {
    return request({
        url: "/wx/order/update",
        method: "post",
        data: query
    })
}
export const delOrder = query => {
    return request({
        url: "/wx/order/del/" + query,
        method: "post"
    })
}